package com.example.multithread.completablefuture;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @ClassName branchDemo
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2020/5/27 4:08 PM
 * @Version 1.0
 */
@Slf4j
public class branchDemo {
	public static void main(String[] args) {
		int i = findLengthOfLCIS(new int[]{2,2,2,2,2,1,2});
		log.info("结果是:{}", i);
	}

	public static int heightChecker(int[] nums) {
		int i = 0, j = nums.length - 1;
		while(i <= j) {
			int m = (i + j) / 2;
			if(nums[m] == m) i = m + 1;
			else j = m - 1;
		}
		return i;
	}

	public int[] aaa(int[] nums) {
		Set<Integer> collect = Arrays.stream(nums).boxed().collect(Collectors.toSet());
		int[] arr = {};
		return null;

	}

	public static int findLengthOfLCIS(int[] nums) {
		if (nums.length == 0) {
			return 0;
		}
		int result = 1;
		int temp = 1;
		for (int i = 0; i < nums.length - 1; i++) {
			if (nums[i + 1] - nums[i] > 0) {
				temp++;
			} else {
				temp = 1;
			}
			if (temp > result) {
				result = temp;
			}
		}
		return result;
	}
}
